package asm;

import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import util.StringUtils;

import java.lang.reflect.Method;

/**
 * Created by Shirly on 2016/10/8.
 */
public class dwad {
    public static void main(String[] args) {
        testParse();
    }

    private void dasd(String s, String s2) {
        System.out.println(123);
    }


    public static void testParse() {
        //表达式解析
        ExpressionParser expressionParser = new SpelExpressionParser();
        Expression expression = expressionParser.parseExpression("#itemId");
        EvaluationContext context = new StandardEvaluationContext();
        context.setVariable("itemId", "100");
        //获取方法参数名
        LocalVariableTableParameterNameDiscoverer discoverer = new LocalVariableTableParameterNameDiscoverer();
        for (Method method : StringUtils.class.getDeclaredMethods()) {
            for (String s : discoverer.getParameterNames(method)) {
                System.out.print("parm: " + s + "  ");
            }
            System.out.println("methodName:  " + method.getName());
        }
    }
}
